<?php


class Solution
{
    public function RomanToInt($romanString)
    {
        $len = strlen($romanString);
        if ($len > 15 || $len < 1) {
            return false;
        }

        $value = [
            'I' => 1,
            'V' => 5,
            'X' => 10,
            'L' => 50,
            'C' => 100,
            'D' => 500,
            'M' => 1000,
        ];

        $i = 0;
        $sum = 0;
        while ($i < $len) {

            if($romanString{$i} == 'I' && $romanString{$i+1}=='V') {
                $sum += 4;
            }

            if($romanString{$i} == 'I' && $romanString{$i+1}=='X') {
                $sum += 9;
            }
        }
    }
}